# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

pkgname=libmikmod
pkgver=3.3.11.1
pkgrel=6
pkgdesc="Module player library supporting many formats, including MOD, S3M, IT and XM"
url="http://mikmod.sourceforge.net"
license=(
  GPL2
  LGPL2.1
)
arch=(loong64 x86_64)
depends=(
  glibc
  libpulse
  sh
)
makedepends=(
  alsa-lib
  cmake
  ninja
)
provides=(libmikmod.so)
options=(debug)
source=(https://downloads.sourceforge.net/mikmod/libmikmod-$pkgver.tar.gz
        cmake-man.diff)
md5sums=('f69d7dd06d307e888f466fc27f4f680b'
         'e8a338d92027072971f49b495e87c442')
sha256sums=('ad9d64dfc8f83684876419ea7cd4ff4a41d8bcd8c23ef37ecb3a200a16b46d19'
            '3331b6ff7f6f3dfd33f543d64affc10a127f61bed1160f75b07344c03f21b840')

prepare() {
  cd libmikmod-$pkgver
  patch -Np1 -i ../cmake-man.diff
}

build() {
  cmake -S libmikmod-$pkgver -B build -G Ninja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=None \
    -DENABLE_DL=1
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build

  install -Dt "$pkgdir/usr/share/aclocal" -m644 libmikmod-$pkgver/libmikmod.m4
  install -Dt "$pkgdir/usr/share/doc/$pkgname" -m644 \
    libmikmod-$pkgver/{NEWS,README,TODO} build/docs/mikmod.html
  install -Dt "$pkgdir/usr/share/info" build/docs/mikmod.info
  install -Dt "$pkgdir/usr/share/man/man1" build/docs/libmikmod-config.1
}

# vim:set sw=2 sts=-1 et:
